<template>
	<view class="control-examine-detail">
		<titleName :name="name" :backShow="true"></titleName>
		<view class="approve-down">
			<view class="top-bgc">
				<view class="type">{{examineFlag==2?'整改期限提醒':'预警管控提醒'}}</view>
				<view class="status">{{examineFlag==2?'整改执行驳回':'管控执行驳回'}}</view>
				<view class="address">
					<image class="img" :src="resourceUrl+'login-huanbao-bgc.png'"></image>
					<view class="content">
						<view class="name">{{msgObj.publisher}}</view>
						<view class="publish-time">
							<view class="publish">发布</view>
							<view class="time">{{msgObj.publishdate}}</view>
						</view>
					</view>
				</view>
			</view>
			<!-- 预警管控提醒 -->
			<template v-if="examineFlag==1">
				<view class="btm-bgc">
					<view class="con">
						<view class="name">预警等级：</view>
						<view class="val">
							{{msgObj.colorlevel==1?'红色预警':msgObj.colorlevel==2?'橙色预警':msgObj.colorlevel==3?'黄色预警':''}}
						</view>
					</view>
					<view class="con">
						<view class="name">启警时间：</view>
						<view class="val">{{msgObj.followtime}}</view>
					</view>
					<view class="con">
						<view class="name">执行时间：</view>
						<view class="val">{{msgObj.noticeFollow.shtime}}</view>
					</view>
					<view class="img-wrap">
						<view class="name">执行图片：</view>
						<view class="img">
							<image @click="lookImg(item,index)" v-for="item,index in images" :src="item" mode="">
							</image>
						</view>
					</view>
					<view class="con">
						<view class="name">驳回原因：</view>
						<view class="val">{{msgObj.noticeFollow.shdescription}}</view>
					</view>
					<view class="btn-wrap" @click="jumpExec">
						<button class="btn">立即执行</button>
					</view>
				</view>
			</template>
			<!-- 整改期限提醒 -->
			<template v-if="examineFlag==2">
				<view class="btm-bgc">
					<view class="con">
						<view class="name">整改内容：</view>
						<view class="val">{{msgObj.content}}</view>
					</view>
					<view class="con">
						<view class="name">备注：</view>
						<view class="val">{{msgObj.noticeFollow.followremark}}</view>
					</view>
					<view class="con">
						<view class="name">整改时间：</view>
						<view class="val">{{msgObj.noticeFollow.shtime}}</view>
					</view>
					<view class="img-wrap">
						<view class="name">整改图片：</view>
						<view class="img">
							<image @click="lookImg(item,index)" :key="item.id" v-for="item,index in images" :src="item"
								mode="">
							</image>
						</view>
					</view>
					<view class="con" v-if="msgObj.status!=3">
						<view class="name">驳回原因：</view>
						<view class="val">{{msgObj.noticeFollow.shdescription}}</view>
					</view>
					<view class="abarbeitung-btn" v-if="msgObj.status!=3">
						<button @click="jumpRectification">立即执行</button>
					</view>
				</view>
			</template>
		</view>
	</view>
</template>

<script setup>
	import titleName from '../../components/titleName.vue'

	import {
		resourceUrl
	} from '../../request/config'
	import http from '../../request/index.js'
	import {
		reactive,
		ref
	} from 'vue'
	import {
		onShow,
		onLoad
	} from "@dcloudio/uni-app"
	let name = "消息"
	let seltop = ref(1)
	let examineFlag = ref('') //判断审核类型
	let dataList = ref([])
	let title = ref('')
	let approveFlag = ref(false) //是否已审批
	let single = ref('')
	let images = ref([])
	let usertype = ref('')
	let params = ref({})
	let passStatus = ref(true)
	let maskFlag = ref(false)
	let rejectFlag = ref(true)
	let msgObj = ref({})
	onLoad((e) => {
		examineFlag.value = e.examineFlag
		if (examineFlag.value == 2) {
			http({
				url: '/greenMessage/detailv2',
				data: {
					id: e.id
				}
			}).then((res) => {
				if (res.code == 0) {
					msgObj.value = res.data
					images.value = res.data.noticeFollow.followattachurl.split(',')
				}
			})
		} else {
			http({
				url: '/greenNotice/detail',
				data: {
					id: e.id
				}
			}).then((res) => {
				if (res.code == 0) {
					msgObj.value = res.data
					images.value = res.data.noticeFollow.followattachurl.split(',')
				}
			})
		}

		// approveFlag
	})
	onShow(() => {

	})
	let lookImg = (item, index) => {
		uni.previewImage({
			urls: images.value,
			current: index
		})
	}
	let jumpExec = () => {
		uni.redirectTo({
			url: `/homePageOther/execute/index?id=${msgObj.value.id}&colorlevel=${msgObj.value.colorlevel}&monitortimestr=${msgObj.value.monitortimestr}&enterprise=${msgObj.value.lstEnterpriseMeasure[0].fld1}&followstatus=${msgObj.value.followstatus}&followattachurl=${msgObj.value.noticeFollow.followattachurl}`
		})
	}
	let jumpRectification = () => {

		uni.redirectTo({
			url: `/homePageOther/rectification/index?enterprise=${msgObj.value.enterprisename}&content=${msgObj.value.content}&noticeid=${msgObj.value.noticeid}&id=${msgObj.value.id}&followattachurl=${msgObj.value.noticeFollow.followattachurl}&followremark=${msgObj.value.noticeFollow.followremark}&status=${msgObj.value.noticeFollow.status}`
		})
	}
	let getList = () => {



	}
	let pass = () => {
		maskFlag.value = true
		passStatus.value = true
		rejectFlag.value = false
	}
	let sureReject = () => {
		passStatus.value = false
		rejectFlag.value = false
	}
	let reject = () => {
		maskFlag.value = true
		passStatus.value = false
		rejectFlag.value = true
	}
</script>

<style lang="scss" scoped>
	.control-examine-detail {
		width: 100vw;
		height: 100vh;
		overflow: hidden;



		.approve-down {
			width: 100vw;
			height: calc(100vh - 160upx);
			background: #F3F5F7;
			// padding: 26upx 24upx 0upx 24upx;
			overflow: scroll;

			.btm-bgc {
				width: 100%;
				margin-top: 18upx;
				background: #FFFFFF;
				border-radius: 14rpx;
				padding: 10upx 20upx 100upx 48upx;

				.abarbeitung-btn {
					margin-top: 160upx;

					button {
						width: 649rpx;
						height: 87rpx;
						background: #0874FA;
						border-radius: 43rpx;
						font-family: PingFang SC;
						font-weight: 500;
						font-size: 31rpx;
						color: #FFFFFF;
						line-height: 87rpx;
						text-align: center;
					}
				}

				.btn-wrap {
					margin-top: 160upx;

					.btn {
						width: 649rpx;
						height: 87rpx;
						background: #0874FA;
						border-radius: 43rpx;

						font-family: PingFang SC;
						font-weight: 500;
						font-size: 31rpx;
						color: #FFFFFF;
						text-align: center;
						line-height: 87rpx;
					}
				}

				.con {
					display: flex;
					align-items: center;
					margin-top: 32upx;

					.name {

						font-family: Source Han Sans CN;
						font-weight: 400;
						font-size: 31rpx;
						color: #404246;
						flex-shrink: 0;
						align-self: flex-start;
					}

					.val {

						font-family: Source Han Sans CN;
						font-weight: 400;
						font-size: 31rpx;
						color: #080A0B;

					}
				}

				.img-wrap {
					display: flex;
					flex-direction: column;
					margin-top: 32upx;

					.name {

						font-family: Source Han Sans CN;
						font-weight: 400;
						font-size: 31rpx;
						color: #404246;

					}

					.img {

						image {
							margin-top: 30upx;
							margin-left: 20upx !important;
							width: 200rpx;
							height: 220rpx;
							border-radius: 10upx;
						}

						image:nth-of-type(3n+1) {
							margin-left: 0upx !important;
						}

					}

				}
			}

			.top-bgc {
				background-color: #fff;
				width: 100%;
				height: 276rpx;
				background: #FFFFFF;
				border-radius: 14rpx;
				padding: 30upx 0 0 50upx;

				.type {

					font-family: Microsoft YaHei;
					font-weight: 400;
					font-size: 42rpx;
					color: #34363A;

				}

				.status {
					margin-top: 28upx;
					font-family: Microsoft YaHei;
					font-weight: 400;
					font-size: 31rpx;
					color: #96989F;

				}

				.address {
					margin-top: 32upx;
					display: flex;
					align-items: center;

					.img {
						width: 55upx;
						height: 55upx;
						margin-right: 9upx;
					}

					.content {
						display: flex;
						flex-direction: column;
						justify-content: space-between;

						.name {

							font-family: Source Han Sans CN;
							font-weight: 500;
							font-size: 24rpx;
							color: #070707;

						}


						.publish-time {
							display: flex;
							align-items: center;

							.publish {
								width: 48rpx;
								height: 23rpx;
								background: #EEF2FF;
								border-radius: 6rpx;

								font-family: Source Han Sans CN;
								font-weight: 500;
								font-size: 14rpx;
								color: #0874FA;
								text-align: center;
								line-height: 23rpx;
							}

							.time {

								font-family: Source Han Sans CN;
								font-weight: 400;
								font-size: 22rpx;
								color: #999999;
								margin-left: 6upx;

							}
						}

					}
				}

			}

		}





	}
</style>